const sci = {};
sci.getRankingInfo = function(name) {
    let rankingInfo = {};
    rankingInfo.rankings = [];
    rankingInfo.info = '';

    let ranking = sci.rankingFullName[name];
    if (ranking == null) {
        ranking = ""
    }
    else {
        ranking = "SCI " + ranking;
    }
    rankingInfo.rankings.push(ranking);

    return rankingInfo;
}

sci.getInfo = function(name) {  //返回一个包含信息的对象
    let Info = {};  //初始化对象
    Info.rankings = [];
    Info.info = '';
    let ranking;
    for(let i = 0; i < name.length; i++) {
        ranking = sci.rankingFullNameEn[name[i]];
        if(ranking != null){
            break;
        }
    }
    if (ranking == null) {
        ranking = "";
    }else{
        ranking = "SCI " + ranking;
    }
    Info.rankings.push(ranking);
    console.log(Info.rankings);
    return Info;
}




sci.getRankingClass = function(rankings) {
    for (let result of rankings) { //
        if (result === "SCI Q1") {
            return 'sci-Q1';
        } else if (result === "SCI Q2") {
            return 'sci-Q2';
        } else if (result === "SCI Q3") {
            return 'sci-Q3';
        } else if (result === "SCI Q4") {
            return 'sci-Q4';
        }
    }
    return 'sci-none';
}

sci.getRankingSpanEn = function(name) {
    let rankInfo = sci.getInfo(name);
    let span = $('<span>').addClass(sci.getRankingClass(rankInfo.rankings)).text(
        rankInfo.rankings.join('/'));
    if (sci.getRankingClass(rankInfo.rankings) !== "sci-none"){
        span.addClass("ccf-ranking");
    }
    return span;
}

